<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: products_expected.php 101 2013-09-21 12:06:08Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 101 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-21 12:06:08 +0000 (Sat, 21 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

require('includes/application_top.php');

# $db->db_query("UPDATE ".TABLE_PRODUCTS." SET products_date_available = '' WHERE to_days(now()) > to_days(products_date_available)");

include('includes/metatag.php');
?>
</head>
<body>
<?php require(DIR_WS_INCLUDES.'header.php'); ?>
<div id="wrapper">
	<table class="outerTable" cellpadding="0" cellspacing="0">
		<tr>
			<td class="columnLeft2" width="<?php echo BOX_WIDTH; ?>" valign="top">
				<?php require(DIR_WS_INCLUDES.'column_left.php'); ?>
			</td>
			<td class="boxCenter" valign="top">
				<table width="100%">
					<tr>
						<td width="100%">
							<table class="table_pageHeading">
								<tr>
									<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td>
							<table width="100%" cellspacing="0" cellpadding="0">
								<tr>
									<td valign="top">
										<table width="100%" class="dataTable">
											<tr class="dataTableHeadingRow">
												<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
												<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_DATE_EXPECTED; ?></td>
												<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
											</tr>
											<?php
												$sql = "SELECT
															pd.products_id,
															pd.products_name,
															p.products_date_available
														FROM
															".TABLE_PRODUCTS_DESCRIPTION." pd,
															".TABLE_PRODUCTS." p
														WHERE
															p.products_id = pd.products_id
														AND
															p.products_date_available != ''
														AND
															pd.language_id = '".$_SESSION['languages_id']."'
														ORDER BY
															p.products_date_available DESC";

												$query = page_break_create($_POST['per_site'], $_GET['page'], $sql, 'products_expected.php');

												$products = $query['query'];

												if($products->_numOfRows) {
													while(!$products->EOF) {
														if (((!$_GET['pID']) || ($_GET['pID'] == $products->fields['products_id'])) && (!$pInfo) ) {
															$pInfo = new objectInfo($products->fields);
														}

														if ( (is_object($pInfo)) && ($products->fields['products_id'] == $pInfo->products_id) )
															echo '<tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'pointer\'" onclick="document.location.href=\''.href_link(FILENAME_CATEGORIES, 'pID='.$products->fields['products_id'].'&action=new_product').'\'">'."\n";
														else
															echo '<tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'pointer\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\''.href_link(FILENAME_PRODUCTS_EXPECTED, 'page='.$_GET['page'].'&pID='.$products->fields['products_id']).'\'">'."\n"; ?>

										                <td class="dataTableContent"><?php echo $products->fields['products_name']; ?></td>
										                <td class="dataTableContent" align="center"><?php echo date_short($products->fields['products_date_available']); ?></td>
										                <td class="dataTableContent" align="right">
										                	<?php if ( (is_object($pInfo)) && ($products->fields['products_id'] == $pInfo->products_id))
										                		echo image(DIR_WS_IMAGES.'icon_arrow_right.gif');
										                	else
										                		echo '<a href="'.href_link(FILENAME_PRODUCTS_EXPECTED, 'page='.$_GET['page'].'&pID='.$products->fields['products_id']).'">'.image(DIR_WS_IMAGES.'icon_info.gif', IMAGE_ICON_INFO).'</a>'; echo '</td>';

														echo '</tr>';
														$products->MoveNext();
													}
												} else
													echo '<tr><td colspan="3" align="center">derzeit gibt es hier keine Produkte zum darstellen</td></tr>';
											?>
										</table>
										<table width="100%">
											<tr class="page_break">
											<td class="smallText" valign="top" width="33.3%"><?php echo 'Angezeigt werden '.$query['from'].' bis '.$query['to'].' (von insgesamt '.$query['total'].' Artikeln)'; ?></td>
											<td class="smallText" align="center" width="33.3%"></td>
											<td class="smallText" align="right" width="33.3%">
												Produkte pro Seite: <?php echo $query['page_break']->perSiteDropdown($_GET['page']); ?>
											</td>
										</tr>
										</table>
									</td>
									<?php
									  $heading = array();
									  $contents = array();
									  if (is_object($pInfo)) {
									    $heading[] = array('text' => '<b>'.$pInfo->products_name.'</b>');

									    $contents[] = array('align' => 'center', 'text' => '<a class="button" onClick="this.blur();" href="'.href_link(FILENAME_CATEGORIES, 'pID='.$pInfo->products_id.'&action=new_product').'">'.BUTTON_EDIT.'</a>');
									    $contents[] = array('text' => '<br />'.TEXT_INFO_DATE_EXPECTED.' '.date_short($pInfo->products_date_available));
									  }

									  if ( (not_null($heading)) && (not_null($contents)) ) {
									    echo '            <td width="25%" valign="top">'."\n";

									    $box = new box;
									    echo $box->infoBox($heading, $contents);

									    echo '            </td>'."\n";
									  }
									?>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</div>
<?php require(DIR_WS_INCLUDES.'footer.php'); ?>
</body>
</html>
<?php require(DIR_WS_INCLUDES.'application_bottom.php'); ?>